package com.sskj.gocoinapp.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.gocoinapp.bean.Stock;
import com.sskj.gocoinapp.http.HttpConfig;
import com.sskj.gocoinapp.ui.fragment.ChartFragment;
import com.sskj.lib.http.JsonCallBack;

import java.util.List;


public class ChartFragmentPresenter extends BasePresenter<ChartFragment> {


    /**
     * 获取k线数据
     *
     * @param goodsType 分时数据标示
     * @param code      币种
     * @return
     */
    public void getKData(String goodsType, String code) {
        httpService.getKData(goodsType, code).execute(new JsonCallBack<HttpData<List<Stock>>>() {
            @Override
            public void onSuccess(Response<HttpData<List<Stock>>> response) {
                HttpData<List<Stock>> httpData = response.body();
                if (httpData.getStatus() == HttpConfig.OK) {

                    mView.setChart(httpData.getData());
                }
            }
        });
    }


}
